using System.Web.UI;
using System.Web.UI.WebControls.WebParts;

namespace Synergy.Web.UI.WebControls.WebParts
{
	/// <summary>
	/// Base class for user controls that are contained within an <see cref="IWebPart"/> instance of type 
	/// <typeparamref name="TWebPart"/>.
	/// </summary>
	/// <typeparam name="TWebPart">The type of the web part.</typeparam>
	/// <remarks>
	///		<list type="table">
	///			<listheader><term>Version</term><description>Description</description></listheader>
	///			<item>
	///				<term>1.0</term>
	///				<description>Initial version</description>
	///			</item>
	///		</list>
	/// </remarks>
    public class WebPartUserControlBase<TWebPart> : UserControl, IWebPartContentControl<TWebPart> 
        where TWebPart : IWebPart
    {
		/// <summary>
		/// Gets or sets the web part that wraps this user control.
		/// </summary>
		/// <value>The web part.</value>
        IWebPart IWebPartContentControl.WebPart
    	{
    		get { return WebPart; }
    		set { WebPart = (TWebPart)value; }
    	}


		/// <summary>
		/// Gets or sets the web part that wraps this user control.
		/// </summary>
		/// <value>The web part.</value>
    	public TWebPart WebPart { get; set; }
    }
}